<%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@page pageEncoding="UTF-8"%>
<%@include file="../WEB-INF/jspf/controlesessao.jspf"%>

<sql:query var="query" dataSource="jdbc/dbo_MicrosoftSQLServer">
    select d.* from Docentes d
    left join  Componentes_Docentes cd on cd.matricula=d.matricula
    where (cd.id_componente=? or (d.matricula='999999' or d.matricula='999998'))
    <sql:param value="${param.id_componente}"/>
    order by NOME
</sql:query>
<select>
<c:forEach var="row" items="${query.rows}">
        <option value="${row.matricula}">${row.NOME}</option>
</c:forEach>   
</select>